package logParser;

/**
 * @projectName: endurance_test
 * @className: TaskData
 * @description:
 * @author: JLONG
 * @date: 2024/10/25 10:05
 * @version: 1.0
 */
public class TaskData {

    private final String taskName;
    private int total_counter;
    private int success_counter;
    private int failed_counter;

    public TaskData(String taskName) {
        this.taskName = taskName;
        this.success_counter = 0;
        this.failed_counter = 0;
        this.total_counter = 0;
    }


    public void addSuccessCounter() {
        this.success_counter++;
        this.total_counter++;
    }

    public void addFailedCounter() {
        this.failed_counter++;
        this.total_counter++;
    }

    public String toString(){
        return ("任务名称：" + this.taskName + "\t" + "任务总数-" + this.total_counter + "\t" + "成功数-" + this.success_counter + "\t" + "失败数-" + this.failed_counter + "\t" + "成功率" + String.format("%.2f%%", (double)this.success_counter/this.total_counter*100));
    }
}
